package com.practices;

/**
 * 需求：
 * 定义一个int类型的变量，初始化值为1234，求这个数的个位，十位，百位，千位分别是多少？
 */
public class Demo2 {
    public static void main(String[] args) {
        int num = 1234;
        int ge = num % 10;
        int shi = (num / 10) % 10;
        int bai = (num / 100) % 10;
        int qian = (num / 1000) % 10;
        System.out.println(num + "的个位是" + ge + ",十位是" + shi + ",百位是" + bai + ",千位是" + qian);
    }
}
